<template>
	<view v-if="isShow">
		<view  class="buy-box">
			<view class="center-box" v-if="type === 'Replenishment'">
				<view class="Replenishment" :style="{ height: height }">
					<view class="col1">补仓数量</view>
					<view class="col2">
						<input v-model="value" class="uni-input input" type="number" />
					</view>
				</view>
				<view class="center-button">
					<view class="col col1" @click="close">取消</view>
					<view class="col col2" @click="sub">确定</view>
				</view>
			</view>
			<view class="center-box" v-if="type === 'name'">
				<view class="Replenishment" :style="{ height: height }">
					<view class="col1">昵称</view>
					<view class="col2">
						<input v-model="value" class="uni-input input" />
					</view>
				</view>
				<view class="center-button">
					<view class="col col1" @click="close">取消</view>
					<view class="col col2" @click="sub">确定</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	name: 'typePopup',
	props: {
		// 是否显示当前组件
		isShow: {
			type: Boolean,
			default() {
				return false;
			}
		},
		height: {
			type: String,
			default() {
				return '400rpx';
			}
		},
		type: {
			type: String,
			default() {
				return 'Replenishment';
			}
		}
	},
	data() {
		return {
			value: ''
		};
	},
	methods: {
		// 隐藏
		close() {
			this.$emit('close', false);
		},
		// 确定
		sub() {
			let value = this.value;
			this.$emit('sub', value);
		}
	}
};
</script>

<style scoped lang="scss">
.buy-box {
	background-color: red;
	z-index: 10;
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	right: 0;
	background-color: rgba(0, 0, 0, 0.5);
	.center-box {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		background-color: #ffffff;
		width: 600rpx;
		border-radius: 10rpx;
		overflow: hidden;
		.Replenishment {
			display: flex;
			height: 100rpx;
			align-items: center;
			padding-left: 80rpx;
			.col2 {
				height: 80rpx;
				margin-left: 20rpx;
				border: 1px solid #e3e1e1;
				border-radius: 10rpx;
				input {
					height: 100%;
				}
			}
		}
	}
	.center-button {
		display: flex;
		.col {
			display: flex;
			flex: 1;
			height: 80rpx;
			line-height: 80rpx;
			justify-content: center;
			border-top: 2rpx solid #e3e1e1;
			border-bottom: 2rpx solid #e3e1e1;
			font-weight: 700;
		}
		.col1 {
			border-right: 1rpx solid #e3e1e1;
		}
	}
}
</style>
